set more off

global path "/Users/eborbath/Library/CloudStorage/Dropbox-WZB/Endre Borbath/Papers/Unions/Replication_material/"

do "${path}/parlgov_cablr.do"
do "${path}/unemployment.do"

import delimited "${path}/PEA_2000_2021/PEA_integrated_2000_2021_V2_cleaner_longcov.csv", varnames(1) clear 

gen edate=date if regexm(date, "^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$")
gen date_2021=date if missing(edate)
split date_2021, parse("/")
replace date_20213 = "20" + date_20213
egen date_2021_str=concat(date_20213 date_20212 date_20211), punct("-")
tab date_2021_str
replace edate = date_2021_str if missing(edate) & !missing(date_2021_str)
count if missing(edate)
drop date_2021* date
rename edate date
split date, parse("-")
destring date2 date3 date1, replace
gen edate = mdy(date2, date3, date1)
format edate %d
drop date2 date3 date1
gen qdate = qofd(dofm(ym(year, month)))
format %tq qdate

bigtab qdate year month if year==2021


*Drop Malta, Iceland, Luxemburg - because Union protest btw 2000-2015 is under 20 instances*
replace country_name="united kingdom" if country_name=="northern ireland"

kountry country_name, from(other)
drop country_name
rename NAMES_STD country_name

gen unions=0 
replace unions = 1 if actor_union_private=="yes" | actor_union_public=="yes" | actor_union_both=="yes" | actor_union_unknown=="yes"
gen parties = 1 if actor_party_main_left == "yes" | actor_party_left == "yes" | actor_party_right == "yes" | ///
actor_party_unknown == "yes" | actor_party_far_left == "yes" |  actor_party_far_right == "yes" | /// 
actor_party_main_left == "yes" | actor_party_main_right == "yes"
replace parties=0 if missing(parties)

bigtab country_name unions

bysort country_name: egen tot_events = total(weighted_event) 

bigtab tot_events country_name 

drop tot_events

drop if country_name=="Iceland" 
drop if country_name=="Luxembourg" 
drop if country_name=="Malta"

gen cntrystring = "AT" if country_name=="Austria"
replace cntrystring = "BE" if country_name=="Belgium"
replace cntrystring = "BG" if country_name=="Bulgaria"
replace cntrystring = "CY" if country_name=="Cyprus"
replace cntrystring = "CZ" if country_name=="Czech Republic"
replace cntrystring = "DK" if country_name=="Denmark"
replace cntrystring = "EE" if country_name=="Estonia"
replace cntrystring = "FI" if country_name=="Finland"
replace cntrystring = "FR" if country_name=="France"
replace cntrystring = "DE" if country_name=="Germany"
replace cntrystring = "GR" if country_name=="Greece"
replace cntrystring = "HU" if country_name=="Hungary"
replace cntrystring = "IS" if country_name=="Iceland"
replace cntrystring = "IE" if country_name=="Ireland"
replace cntrystring = "IT" if country_name=="Italy"
replace cntrystring = "LV" if country_name=="Latvia"
replace cntrystring = "LT" if country_name=="Lithuania"
replace cntrystring = "LU" if country_name=="Luxembourg"
replace cntrystring = "MT" if country_name=="Malta"
replace cntrystring = "NL" if country_name=="Netherlands"
replace cntrystring = "NO" if country_name=="Norway"
replace cntrystring = "PL" if country_name=="Poland"
replace cntrystring = "PT" if country_name=="Portugal"
replace cntrystring = "RO" if country_name=="Romania"
replace cntrystring = "SK" if country_name=="Slovak Republic"
replace cntrystring = "SI" if country_name=="Slovenia"
replace cntrystring = "ES" if country_name=="Spain"
replace cntrystring = "SE" if country_name=="Sweden"
replace cntrystring = "CH" if country_name=="Switzerland"
replace cntrystring = "UK" if country_name=="United Kingdom"

encode cntrystring, gen(iso2code)
gen str_label=cntrystring + string(year)

egen bigevent_cat = xtile(weighted_part_all), by(cntrystring) n(5)
gen big_event_num=1 if bigevent_cat==5 
replace big_event_num=0 if missing(big_event_num)

gen cultural=0
replace cultural=1 if issue_cult_lib=="yes" | issue_cult_cons=="yes" | issue_xeno=="yes" | issue_anti_immig=="yes" | ///
issue_pro_immig=="yes" | issue_corona_anti_restric=="yes" | issue_corona_pro_restric=="yes" | issue_education=="yes"

gen political=0
replace political=1 if issue_political=="yes" | issue_environment=="yes" | issue_regional=="yes" | issue_anti_europe=="yes" | issue_pro_europe=="yes" | issue_healthcare=="yes"

// FOR NEW DATASET !!!!! 
gen sponsored=0
replace sponsored=1 if parties==1| actor_union_private=="yes" | actor_union_public=="yes" | actor_union_both== "yes" | /// 
actor_union_unknown=="yes" | actor_prof_org == "yes" | actor_non_prof_org=="yes" | actor_group_occup=="yes" | actor_other=="yes"
keep if sponsored==1
lab var sponsored "sponsored protest (non-missing actor and no social group)"

egen country_total = total(unions), by(country_name)
bigtab country_name country_total
drop country_total

*Generating weighted variables for protest events for UNIONS*
gen wunion_event = weighted_event if unions==1
gen wunion_part = weighted_part_all if unions==1 

egen total_wunion_part=sum(wunion_part)
tab total_wunion_part
egen total_wpart=sum(weighted_part_all)
tab total_wpart

*Private econ strikes vs. all other protest*
gen private_public=.
replace private_public=0 if (issue_econ_private=="yes" & action_form=="strikes" & unions==1)
replace private_public=1 if (unions==1 & private_public==.)
label define private_public 0 "Private econ strikes" 1 "All other union protest", replace
label values private_public private_public


*Weighted private_public*
gen wpublic = weighted_event if private_public==1
gen wprivate = weighted_event if private_public==0
*gen share_wprivate_public=(wpublic/wunion_event)*100 // this does not make sense without some collapse first



*Regions according to Visser, 2009*
gen region_Visser=0
replace region_Visser=1 if inlist(cntrystring, "SE", "DK", "NO", "FI", "IS") //country==6|country==8|country==13|country==21|country==28
replace region_Visser=2 if inlist(cntrystring, "DE", "SI", "BE", "AT", "CH", "NL", "LU")  //country==1|country==2|country==26|country==10|country==18|country==20|country==29
replace region_Visser=3 if inlist(cntrystring, "GR", "FR", "IT", "ES", "PT", "MT")  //country==11|country==15|country==23|country==27|country==9
replace region_Visser=4 if inlist(cntrystring, "CY", "IE", "UK") // country==4|country==14|country==19|country==30|country==31
replace region_Visser=5 if inlist(cntrystring, "HU", "CZ", "EE", "BG", "LT", "SK", "RO", "LV", "PL") // country==3|country==24|country==7|country==16|country==17|country==22|country==5|country==12|country==25

label define region_Visser 1 "Corporatism (North)" 2 "Social-Partnership (West)" 3 "State-centered (South)" 4 "Liberal" 5 "CEE regimes",replace 
label values region_Visser region_Visser

bigtab region_Visser cntrystring 


*Issues: Reference category -> private economic issues*
gen issues_r=0 if issue_econ_private=="yes"
replace issues_r=1 if issue_econ_public=="yes"
replace issues_r=2 if issue_cult_lib=="yes" | issue_cult_cons=="yes" | issue_political=="yes" | ///
issue_xeno=="yes" | issue_regional=="yes" | issue_environment=="yes" | issue_anti_europe=="yes" | ///
issue_anti_immig=="yes" | issue_pro_europe=="yes" | issue_pro_immig=="yes" | issue_corona_anti_restric=="yes" | ///
issue_corona_pro_restric=="yes" | issue_education=="yes" | issue_healthcare=="yes"
replace issues_r=3 if missing(issues_r)
label define issues_r 0 "Econ Private" 1 "Econ Public" 2 "Political/ Cultural" 3 "Other issue", replace 
label values issues_r issues_r
 

*Different forms specified**
gen private_strike=0
replace private_strike=1 if action_form=="strikes" & issue_econ_private=="yes" & unions==1

gen political_strike=0
replace political_strike=1 if action_form=="strikes" & unions==1 & (issue_econ_public=="yes" | issue_political=="yes" | issue_environment=="yes" | issue_regional=="yes" | issue_anti_europe=="yes" | issue_pro_europe=="yes" | issue_healthcare=="yes")

gen demo_unions=0
replace demo_unions=1 if action_form=="demonstrations" & unions==1

gen violence_unions=0
replace violence_unions=1 if action_form=="violent protest" & unions==1

gen cultural_unions=0
replace cultural_unions=1 if unions==1 & (issue_cult_lib=="yes" | issue_cult_cons=="yes" | issue_xeno=="yes" | issue_anti_immig=="yes" | ///
issue_pro_immig=="yes" | issue_corona_anti_restric=="yes" | issue_corona_pro_restric=="yes" | issue_education=="yes")

*Other SG Actor*
gen other_SG=0
replace other_SG=1 if  actor_group_stud=="yes" | actor_group_pens=="yes" | actor_group_other=="yes"

*Define action variable*
gen otherac_new=0
replace otherac_new=1 if action_form=="violent protest" | action_form=="petitions, symbolic actions" | /// 
action_form=="confrontations, blockades" | actor_other=="yes"

gen other_org = 1 if actor_prof_org == "yes" | actor_non_prof_org=="yes" | actor_other=="yes"
replace other_org=0 if missing(other_org)

gen actor_involvement=.
replace actor_involvement=1 if unions==1 & actor_group_occup!="yes" & other_SG==0 & parties==0 & other_org!=1
replace actor_involvement=2 if unions==1 & actor_group_occup=="yes" & other_SG==0 & parties==0 & other_org!=1
replace actor_involvement=3 if unions==1 & actor_group_occup!="yes" & other_SG==1 & parties==0 & other_org!=1
replace actor_involvement=4 if unions==1 & actor_group_occup!="yes" & other_SG==0 & parties==1 & other_org!=1
replace actor_involvement=5 if unions==1 & actor_group_occup!="yes" & other_SG==0 & parties==0 & other_org==1

label define actor_involvement 1 "Only Unions" 2 "Unions & occup. SG" 3 "Unions & other SG" 4 "Unions & parties" 5 "Unions & otherorgs",replace 
label values actor_involvement actor_involvement
tab actor_involvement

drop eurocrisis refugeecrisis
gen shock=1 if edate>=date("20081001","YMD") & edate<date("20100201","YMD") 
gen eurocrisis=1 if edate>=date("20100201","YMD") & edate<=date("20150801","YMD")
gen refugeecrisis = 1 if eurocrisis!=1 & year==2015

*Crisis Variable: Recoded to two crisis periods, too few union cases during refugee crisis*
gen crisis=0
replace crisis=1 if shock==1
replace crisis=2 if eurocrisis==1 | refugeecrisis==1
replace crisis=3 if year>=2016

label define crisis 0 "Normal Times" 1 "Shock" 2 "Eurocrisis" 3 "Post-crises",replace 
label values crisis crisis // 'Normal Times' now also has the post-refugee/ most recent period

bigtab crisis year

*two dummy vars that categorize pre-crisis vs crisis years
gen pre_crisis=0 if shock==1|eurocrisis==1|refugeecrisis==1 
replace pre_crisis=1 if year<=2008 // 'pre-crisis' now also has the post-refugee/ most recent period
label define pre_crisis 0 "Crisis times" 1 "pre-crisis", replace
label values pre_crisis pre_crisis

gen crisis_years=0 if pre_crisis==1 
replace crisis_years=1 if pre_crisis==0

encode action_form, gen(action_x)

gen action_n=0
replace action_n=1 if action_x==3
replace action_n=2 if action_x==5
replace action_n=3 if action_x==6
replace action_n=4 if action_x==2
replace action_n=5 if action_x==7
replace action_n=6 if action_x==4|action_x==1


label define action_n 1 "demonstrations" 2 "petition/ symbolic actions" 3 "strikes" 4 "confrontations/ blockades" 5 "violent protest" 6 "other protest"
label values action_n action_n

rename cntrystring iso2c

append using "${path}/parlgov/parlgov_cleaned.dta"

sort iso2c edate 

foreach var of varlist cabinet_id cabinet_name cab_leftright cab_polarization sys_polarization gov_seatsh caretaker{
	bysort iso2c: carryforward `var', replace
}

drop if missing(weighted_event) // these were all from parlgov - the original cab dates without a protest event

count if missing(cabinet_name)

merge m:1 iso2c qdate using "${path}/unemployment/unemployment_cleaned.dta"

drop if _merge==2 

drop _merge

merge m:1 iso2c qdate using "${path}/unemployment/gdp_per_capita_cleaned.dta"

bigtab iso2c qdate if _merge==2
drop if _merge==2 

drop _merge

merge m:1 iso2c year using "${path}/unemployment/cy_gdp_per_capita.dta"

bigtab iso2c year if _merge==2
drop if _merge==2 

drop _merge

bigtab iso2c if !missing(gdp_per_capita_cy)

replace gdp_per_capita = gdp_per_capita_cy if missing(gdp_per_capita) & !missing(gdp_per_capita_cy)
drop gdp_per_capita_cy

count if missing(gdp_per_capita)


*Institutional variables/ Visser dataset*

merge m:1 iso2c year using "${path}/Visser dataset/Clean_visser_data.dta"
drop if _merge==2
drop _merge

rename UD Union_Density
rename ETNUnions Eff_Number_Unions
rename TC Tripartite_Council 

*destring UD, generate(Union_Density)
*destring ETNUnions, generate(Eff_Number_Unions)

generate Level_new=.
replace Level_new=5 if Level==1
replace Level_new=4 if Level==2
replace Level_new=3 if Level==3
replace Level_new=2 if Level==4
replace Level_new=1 if Level==5

label define Level 1 "Central/ Cross-Industry" 2 "Intermediate central & industry" 3 "Sector/Industry level" 4 "Intermediate Industry & Company" 5 "Company Level", replace
label values Level_new Level

rename country_name country_n

********************************************************************************
********************************************************************************
*********************DESCRIPTIVES***********************************************
********************************************************************************
********************************************************************************
********************************************************************************

* Total number of sponsored protest events in dataset 
count 

* Sum of all participants 
summarize weighted_part_all
egen sumpart = sum(weighted_part_all)

**** FIGURE 1 *******

**Absolute number & Share next to each other****

preserve
collapse (sum) wunion_event weighted_event, by(region_Visser iso2code)
gen wunion_share_country= (wunion_event/weighted_event)*100
bysort region_Visser: egen union_event_regcntry=mean(wunion_event)
bysort region_Visser: egen unionssh_by_regcntry=mean(wunion_share_country)
keep region_Visser union_event_regcntry unionssh_by_regcntry
duplicates drop

tab unionssh_by_regcntry region_Visser
tab union_event_regcntry region_Visser
sum unionssh_by_regcntry

**** To move the bars one over// slight program manipulation necessary***
decode region_Visser, generate(region_Visser_string)
gen region_Visser_pos = (2*_n)-1 +_n-1
gen region_Visser_pos_2=region_Visser_pos+1
*type findit labmask and follow instructions to install
labmask region_Visser_pos_2, values(region_Visser_string)

***Twoway bar command***
twoway bar union_event_regcntry region_Visser_pos, scheme(lean2) yaxis(1) ytitle("Number of union protests", axis(1) size(*.9)) ///
ylabel(0(50)300, axis(1) labsize(*.9) nogrid)  ysc(titlegap(2)) graphregion(fcolor(white)) || ///
bar unionssh_by_regcntry region_Visser_pos_2, fcolor(gray) lcolor(black) yaxis(2) ///
ylabel(0(20)100, axis(2) labsize(*.9)) ///
xlabel(,labsize(*.6)) ///
legend(order(1 "Number of union protest" 2 "Share of union protest") position(6) col(3) bmargin(large) size(*.9) ///
region(lcolor(white))) ///
ytitle("Share of union protest", axis(2) size(*.9)) xtitle("", size(*.9)) xlabel(2(3)14, valuelabel)

graph export "${path}/Figures/figure1.png", height(4000) width(6000) replace
graph export "${path}/Figures/figure1.eps", replace

restore

***** FIGURE 2 *****

*By region: Private vs. Public union protest// PERCENT*
preserve

collapse (sum) wprivate wpublic wunion_event, by(region_Visser iso2code)
gen share_private_regcntry=(wprivate/wunion_event)*100
gen share_public_regcntry=(wpublic/wunion_event)*100
bysort region_Visser: egen wprivate_regcntry=mean(share_private_regcntry)
bysort region_Visser: egen wprivate_public_regcntry=mean(share_public_regcntry)
keep region_Visser wprivate_regcntry wprivate_public_regcntry
duplicates drop

graph bar wprivate_regcntry wprivate_public_regcntry, over(region_Visser, label(labsize(*.6)) ) ytitle("Percentage points (%)") ylabel(0(20)100) blabel(bar, format(%9.0f)) ///
scheme(lean2) percent legend(order(1 "Workplace strikes" 2 "Non-standard union protest") ///
position(6) col(3) bmargin(large)) 

*graph export "${path}/Figures/figure2.png", height(4000) width(6000)  replace
*graph export "${path}/Figures/figure2.eps",  replace

restore

***** FIGURE 3: Scatterplot*********

preserve
collapse (sum) wunion_event wpublic, by(country_n region_Visser iso2code)
gen share_public_regcntry=(wpublic/wunion_event)*100
bysort region_Visser: egen wprivate_public_regcntry=mean(share_public_regcntry)
bysort region_Visser: egen wunion_event_regcntry=mean(wunion_event)
sum wunion_event, d
sum share_public_regcntry, d
keep region_Visser wprivate_public_regcntry wunion_event_regcntry
duplicates drop 

// new yline = 130

graph twoway (scatter wunion_event_regcntry wprivate_public_regcntry, xlabel(0(10)100, grid) ylabel(0(50)350) mlabel(region_Visser) mlabc(gs0) mlabposition(11) mlabsize(3) symbol(o) mcolor(gs0)), xline(50, lp(dash) lcolor(gs9)) yline(130, lp(dash) lcolor(gs9)) legend(off) ytitle("Level of union protest" "(Number of union protest)") xtitle("Movement character of union protest" "(Share of non-standard union protest)") scheme(lean2) 

graph export "${path}/Figures/figure3.png", height(4000) width(6000)  replace
graph export "${path}/Figures/figure3.eps", replace

restore



******* FIGURE 4: Scatterplot on country level ***********

preserve


collapse (sum) wunion_event wpublic, by(country_n iso2code region_Visser)
gen share_wprivate_public=(wpublic/wunion_event)*100
sum wunion_event, d
sum share_wprivate_public, d
graph twoway (scatter wunion_event share_wprivate_public if region_Visser==1, mlabel(iso2code) msymbol(diamond) mlabposition(12)) ///
(scatter wunion_event share_wprivate_public if region_Visser==2, mlabel(iso2code) msymbol(circle) mlabposition(12)) ///
(scatter wunion_event share_wprivate_public if region_Visser==3, mlabel(iso2code) msymbol(plus) mlabposition(12)) ///
(scatter wunion_event share_wprivate_public if region_Visser==4, mlabel(iso2code) msymbol(triangle) mlabposition(12)) ///
(scatter wunion_event share_wprivate_public if region_Visser==5, mlabel(iso2code) msymbol(square) mlabposition(12) ///
scheme(lean2) legend(off) yline(130, lp(dash) lcolor(gs9)) xsc(r(0(10)100)) xlabel(0(10)100) xline(50, lp(dash) lcolor(gs9)) ///
ytitle("Level of union protest" "(Number of union protests)") xtitle("Movement character" "(Share of non-standard union protest)"))

graph export "${path}/Figures/figure4.png", height(4000) width(6000) replace
graph export "${path}/Figures/figure4.eps", replace

restore


* TABLE 2: Union protest issues, action forms, cooperation partners by REGION // average country in region calculated via Excel  


*in old dataset, these were called action_n issues_r

preserve

keep if unions==1
keep issues_r action_n actor_involvement country region_Visser weighted_event

tabulate issues_r, gen(iss_dumm)
tabulate actor_involvement, gen(ai_dumm)
tabulate action_n, gen(act_dumm)

drop issues_r actor_involvement action_n

foreach var of varlist iss_dumm* ai_dumm* act_dumm*{
	replace `var' = `var'*weighted_event
}

collapse (sum) iss_dumm* ai_dumm* act_dumm* weighted_event, by(country region_Visser)

foreach var of varlist iss_dumm* ai_dumm* act_dumm*{
	replace `var' = `var'*100/weighted_event
}

drop weighted_event

collapse (mean) iss_dumm* ai_dumm* act_dumm* , by(region_Visser)

foreach var of varlist iss_dumm* ai_dumm* act_dumm*{
	rename `var' type_`var'
}

reshape long type_, i(region_Visser) j(charac) string 

gen type2="issue" if strpos(charac, "iss_dumm")
replace type2="actor_involvement" if strpos(charac, "ai_dumm")
replace type2="actions" if strpos(charac, "act_dumm")

replace charac="Econ private" if charac=="iss_dumm1"
replace charac="Econ public" if charac=="iss_dumm2"
replace charac="Political/ cultural" if charac=="iss_dumm3"
replace charac="Other issue" if charac=="iss_dumm4"

replace charac="Only Unions" if charac=="ai_dumm1"
replace charac="w. occupational social groups" if charac=="ai_dumm2"
replace charac="w. other social groups" if charac=="ai_dumm3"
replace charac="w. political parties" if charac=="ai_dumm4"
replace charac="w. other actors" if charac=="ai_dumm5"

replace charac="Demonstrations" if charac=="act_dumm1"
replace charac="Petition, symbolic actions" if charac=="act_dumm2"
replace charac="Strikes" if charac=="act_dumm3"
replace charac="Confrontations (blockades)" if charac=="act_dumm4"
replace charac="Violent protest" if charac=="act_dumm5"
replace charac="Other protest" if charac=="act_dumm6"

order region_Visser type2 charac type_ 
sort region_Visser type2 charac

replace type_ = round(type_, 0.5)

rename type_ share

reshape wide share, i(type2 charac) j(region_Visser)

rename share1 Corporatism
rename share2 Social_Partnership
rename share3 State_centered
rename share4 Liberal
rename share5 Transitional

order type2 charac Corporatism Social_Partnership Liberal State_centered Transitional

encode type2, gen(variable)
encode charac, gen(type)

drop type2 charac

gen rank = .
replace rank = 1 if variable == 3
replace rank = 3 if variable == 1
replace rank = 2 if variable == 2

rename type type_num
gen rank2 = .
replace rank2 = 101 if rank == 1 & type_num==3 
replace rank2 = 102 if rank == 1 & type_num==4 
replace rank2 = 103 if rank == 1 & type_num==9 
replace rank2 = 104 if rank == 1 & type_num==6 

replace rank2 = 201 if rank == 2 & type_num==5 
replace rank2 = 202 if rank == 2 & type_num==12 
replace rank2 = 203 if rank == 2 & type_num==14 
replace rank2 = 204 if rank == 2 & type_num==15 
replace rank2 = 205 if rank == 2 & type_num==13 

replace rank2 = 301 if rank == 3 & type_num==10 
replace rank2 = 302 if rank == 3 & type_num==2 
replace rank2 = 303 if rank == 3 & type_num==8 
replace rank2 = 304 if rank == 3 & type_num==1 
replace rank2 = 305 if rank == 3 & type_num==11 
replace rank2 = 306 if rank == 3 & type_num==7 


sort rank rank2

drop rank rank2

foreach var in Corporatism Social_Partnership Liberal State_centered Transitional {
	tostring `var', replace
    replace `var' = `var' + "%"
}

export excel using "${path}/Figures/table2.xls", firstrow(variables) replace

restore


***** Descriptive table in the appendix ****

*unions private_public econ_private econ_public political cultural demo strike socialgroups_occup other_SG parties big_event_num region_Visser crisis unemployment_q cab_leftright

gen econ_private = 1 if issue_econ_private=="yes"
replace econ_private= 0 if issue_econ_private=="no"
gen econ_public = 1 if issue_econ_public=="yes"
replace econ_public = 0 if issue_econ_public=="no"
gen strike = 1 if action_n==3
replace strike = 0 if missing(strike)
gen demo = 1 if action_n == 1
replace demo = 0 if missing(demo)

gen socialgroups_occup = 1 if actor_group_occup=="yes"
replace socialgroups_occup = 0 if actor_group_occup=="no"

gen part_num=weighted_part_all/1000

tab iso2code, m

preserve

keep country_n iso2c iso2code str_label year weighted_event weighted_part_all edate unions private_public econ_private econ_public political cultural demo strike socialgroups_occup other_SG parties region_Visser crisis unemployment_q cab_leftright part_num pre_crisis crisis_years gdp_per_capita Eff_Number_Unions Level_new RI Tripartite_Council Union_Density edate

save "${path}/reg_vars.dta", replace 

restore


********************************************************************************************
********************************************************************************************
*********************    APPENDIX    *******************************************************
********************************************************************************************


*** Descriptives 


*Figure 1 

*Private vs. public on country-level 
preserve
collapse (sum) wprivate wpublic, by(country_n)
graph bar wprivate wpublic, over(country_n, sort(1) descending label(angle(45) labsize(small))) scheme(lean2) legend(position(6) col(3) bmargin(large)) legend(order(1 "Private economic strikes" 2 "All other union protest"))
graph export "${path}/Appendix/figure1.png", height(4000) width(6000) replace
restore

preserve
collapse (sum) wprivate wpublic wunion_event, by(country_n)
gen share_wpublic=(wpublic/wunion_event)*100
gen share_wprivate=(wprivate/wunion_event)*100

graph bar share_wprivate share_wpublic, over(country_n, sort(1) descending label(angle(45) labsize(small))) scheme(lean2) percent legend(position(6) col(3) bmargin(large)) legend(order(1 "Share of private economic strikes" 2 "Share of non-standard union protest") size(small))
graph export "${path}/Appendix/figure2.png", height(4000) width(6000) replace
restore

